<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="UTF-8">
<title>Government Sanctioned Builder Application</title>

<!-- This is really ugly -->
 
<script src="/dhtmlx/dhtmlxCombo/codebase/dhtmlxcommon.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxLayout/codebase/dhtmlxcontainer.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxConnector/codebase/connector.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxForm/codebase/dhtmlxform.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js" type="text/javascript"></script>

<script src="/dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxMenu/codebase/dhtmlxmenu.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxSlider/codebase/dhtmlxslider.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxTabbar/codebase/dhtmlxcontainer.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxTabbar/codebase/dhtmlxtabbar.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxTabbar/codebase/dhtmlxtabbar_start.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxToolbar/codebase/dhtmlxtoolbar.js" type="text/javascript"></script>
<script src="/dhtmlx/dhtmlxTree/codebase/dhtmlxtree.js" type="text/javascript"></script>
<!-- <script src="/dhtmlx/dhtmlxVault/codebase/dhtmlxvault.js" type="text/javascript"></script> -->
<script src="/dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.js" type="text/javascript"></script>

<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxCombo/codebase/dhtmlxcombo.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxLayout/codebase/dhtmlxlayout.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_skyblue.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxMenu/codebase/skins/dhtmlxmenu_dhx_skyblue.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxSlider/codebase/dhtmlxslider.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxTabbar/codebase/dhtmlxtabbar.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_skyblue.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxTree/codebase/dhtmlxtree.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxVault/codebase/dhtmlxvault.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxWindows/codebase/dhtmlxwindows.css" />
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxWindows/codebase/skins/dhtmlxwindows_dhx_skyblue.css" />
<link rel="stylesheet" type="text/css" href="codebase/dhtmlx_custom.css" />

<!-- 
<script src="codebase/dhtmlx.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="codebase/dhtmlx.css" />
<link rel="stylesheet" type="text/css" href="codebase/dhtmlx_custom.css" /> 
<script src="codebase/connector/connector.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/dhtmlx/dhtmlxForm/codebase/dhtmlxform.css" />
<script src="/dhtmlx/dhtmlxForm/codebase/dhtmlxform.js" type="text/javascript"></script>
-->

<style>
html, body {
	width: 100%;
	height: 100%;
	margin: 0px;
	overflow: hidden;
	background-color:white;
}
</style>



<!-- Application code -->
<script type="text/javascript">

var layout, menu, toolbar, dbTree, areaDetailTabs, objectDetailForm, objectPropertiesForm;
var roomDetailTabs, itemDetailTabs, wpnDetailTabs, npcDetailTabs, dhxWins;

dhtmlx.image_path = "codebase/imgs/";

dhtmlxEvent(window,"load",function() {
	// layout
	layout = new dhtmlXLayoutObject(document.body,"3L");
	layout.cells("a").setText("Game Object DB");
	layout.cells("b").setText("Object Details");
	layout.cells("c").setText("Object Support");
	layout.cells("c").hideHeader();
	layout.cells("a").setWidth(400);
	var sublayout = layout.cells("c").attachLayout("2U");
	layout.cells("b").setHeight(600);
	sublayout.cells("a").setText("Object Properties");
	sublayout.cells("b").setText("Status Information");

	// Top-level window
	dhxWins = new dhtmlXWindows();
	
	// Menu strip
	menu = layout.attachMenu();
	menu.setIconsPath("codebase/icons/");
	menu.loadXML("xml/menu.xml");
	menu.attachEvent("onClick",menuClick);
	
	// Toolbar strip
	toolbar = layout.attachToolbar();
	toolbar.setIconsPath("codebase/icons/");
	toolbar.loadXML("xml/toolbar.xml");
//	toolbar.disableItem("logout");
	toolbar.attachEvent("onClick", function(id) {
		alert("Button "+id+" was clicked");
		if (id == "login") {
			var win = dhxWins.createWindow("login",15,40,300,300);
			dhxWins.window("login").center();
			dhxWins.window("login").attachURL("login.php");
			
		} else if (id == "logout") {
			
		} else if (id == "cut") {
			
		} else if (id == "copy") {
			
		} else if (id == "paste") {
			
		} else if (id == "newArea") {
			
		} else if (id == "newRoom") {
			
		} else if (id == "newDoor") {
			
		} else if (id == "newNPC") {
			
		} else if (id == "newObject") {
			
		}  else if (id == "help") {
			
		}
	});
	
	// Database tree
	dbTree = layout.cells("a").attachTree("0");
	dbTree.setImagePath("codebase/imgs/");
//	dbTree.setXMLAutoLoading("xml/dbtree.php");
	dbTree.loadXML("xml/dbtree.php");
	dbTree.attachEvent("onSelect",function (id) {
		if (id == "area") {
			layout.cells("b").view("area").setActive();
//			layout.cells("b").view("area").show();
		} else if (id == "room") {
			layout.cells("b").view("room").setActive();
//			layout.cells("b").view("room").show();
		} else if (id == "door") {
			layout.cells("b").view("door").setActive();
//			layout.cells("b").view("room").show();
		} else if (id == "npc") {
			layout.cells("b").view("npc").setActive();
//			layout.cells("b").view("room").show();
		} else if (id == "item") {
			layout.cells("b").view("item").setActive();
//			layout.cells("b").view("room").show();
		} else if (id == "wpn") {
			layout.cells("b").view("wpn").setActive();
//			layout.cells("b").view("room").show();
		} else if (id == "vehicle") {
			layout.cells("b").view("vehicle").setActive();
//			layout.cells("b").view("room").show();
		}
	});
	
	// Tabs for our form window
	// First set of tabs: area
	areaDetailTabs = layout.cells("b").view("area").attachTabbar();
	areaDetailTabs.setImagePath("codebase/imgs/");
	areaDetailTabs.addTab("tabSummary","Summary","100px");
	areaDetailTabs.addTab("tabFlags","Flags","100px");
	areaDetailTabs.addTab("tabRooms","Connected Rooms","200px");
	areaDetailTabs.addTab("tabExits","Exits","100px");
	areaDetailTabs.addTab("tabNeighbors", "Neighbors","100px");
	// Attach the different forms to this view's tabs
	objectDetailForm = areaDetailTabs.cells("tabSummary").attachForm("areaSummaryForm");
//	objectDetailForm = areaDetailTabs.cells("tabSummary").attachDataView();
	objectDetailForm.loadStruct("xml/asf.xml");
	var areaFlagForm = areaDetailTabs.cells("tabFlags").attachForm("areaFlags");
	areaFlagForm.loadStruct("xml/aff.xml");
	var areaRoomsGrid = areaDetailTabs.cells("tabRooms").attachGrid();
	areaRoomsGrid.setImagePath("codebase/imgs/");
	areaRoomsGrid.setHeader("Room ID,Room Tag, Name");
	areaRoomsGrid.setInitWidths("150,250,*");
	areaRoomsGrid.init();
	
	// Room's detail tabs and forms
	roomDetailTabs = layout.cells("b").view("room").attachTabbar();
	roomDetailTabs.setImagePath("codebase/imgs/");
	roomDetailTabs.addTab("tabSummary","Summary","100px");
	roomDetailTabs.addTab("tabFlags","Flags","100px");
	roomDetailTabs.addTab("tabExits","Doors","100px");
	roomDetailTabs.addTab("tabObjects","Objects","100px");
	roomDetailTabs.addTab("tabNPC", "NPCs", "100px");
	// roomDetailTabs.addTab("tabShops", "Shops", "100px");
	// roomDetailTabs.addTab("tabBanks", "Banks", "100px");
	// roomDetailTabs.addTab("tabAuction", "Auction Houses", "150px");
	// roomDetailTabs.addTab("tabResidence", "Residences", "100px");
	roomDetailTabs.addTab("tabMap", "Map", "80px");
	
	var roomSummaryForm = roomDetailTabs.cells("tabSummary").attachForm("roomSummaryForm");
	roomSummaryForm.loadStruct("xml/rsf.xml");
	var roomFlagsForm = roomDetailTabs.cells("tabFlags").attachForm("roomFlagsForm");
	roomFlagsForm.loadStruct("xml/rff.xml");
	var roomDoorGrid = roomDetailTabs.cells("tabExits").attachGrid();
	roomDoorGrid.setImagePath("codebase/imgs/");
	roomDoorGrid.setHeader("ID,Door Name,Type,Tag,Room1,Room2,UUID");
	roomDoorGrid.setInitWidths("*,150,150,150,150,200");
	roomDoorGrid.init();	
	var roomObjectGrid = roomDetailTabs.cells("tabObjects").attachGrid();
	roomObjectGrid.setImagePath("codebase/imgs/");
	roomObjectGrid.setHeader("ID, Object Name,Type,Number,UUID");
	roomObjectGrid.setInitWidths("80,*,150,150,200");
	roomObjectGrid.init();
	var roomNPCGrid = roomDetailTabs.cells("tabNPC").attachGrid();
	roomNPCGrid.setImagePath("codebase/imgs/");
	roomNPCGrid.setHeader("NPC Name,Type,Number,Program");
	roomNPCGrid.setInitWidths("*,100,50,250");
	roomNPCGrid.init();
	
	// Doors tabs
	var doorsDetailTabs = layout.cells("b").view("door").attachTabbar();
	doorsDetailTabs.setImagePath("codebase/imgs/");
	doorsDetailTabs.addTab("tabSummary","Summary","100px");
	var doorDetailForm = doorsDetailTabs.cells("tabSummary").attachForm();
	doorDetailForm.loadStruct("xml/doorsummary.xml");
	
	// NPC tabs
	var npcDetailTabs = layout.cells("b").view("npc").attachTabbar();
	npcDetailTabs.setImagePath("codebase/imgs/");
	npcDetailTabs.addTab("tabSummary","Summary","100px")
	var npcDetailForm = npcDetailTabs.cells("tabSummary").attachForm();
	npcDetailForm.loadStruct("xml/npcsummary.xml");
	
	// Items tabs
	var itemDetailTabs = layout.cells("b").view("item").attachTabbar();
	itemDetailTabs.setImagePath("codebase/imgs/");
	itemDetailTabs.addTab("tabSummary","Summary","100px")
	
	// Weapons tabs
	var wpnDetailTabs = layout.cells("b").view("wpn").attachTabbar();
	wpnDetailTabs.setImagePath("codebase/imgs/");
	wpnDetailTabs.addTab("tabSummary","Summary","100px")
	
	// Vehicles tabs
	var vehicleDetailTabs = layout.cells("b").view("vehicle").attachTabbar();
	vehicleDetailTabs.setImagePath("codebase/imgs/");
	vehicleDetailTabs.addTab("tabSummary","Summary","100px")
	
	

	
	// Properties window
	//sublayout.cells("a").setWidth(200);
	//sublayout.cells("a").fixSize(true,true);
	sublayout.cells("a").attachURL("http://192.168.1.108/builder/prop.html");
	
});

function menuClick(id) {
	alert("Clicked "+id);
	if (id == "menuMissionsView") {
		var win = dhxWins.createWindow("viewmissions",15,40,800,300);
		dhxWins.window("viewmissions").center();
		var missionGrid = dhxWins.window("viewmissions").attachGrid();
		missionGrid.setImagePath("codebase/imgs/");
		missionGrid.setHeader("ID,Name,Type,Quest Giver,Location,Threat Level");
		missionGrid.setInitWidths("60,200,150,100,100,150");
		missionGrid.init();	
		missionGrid.loadXML("xml/missionGrid.php");
	}
}


</script>

</head>
<body>

</body>
</html>
